package me.pplay.playtalk.activity;

import me.pplay.playtalk.ApplicationTrans;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.Toast;

public class BaseActivity extends Activity {
//	public static final int SETADAPTER 					= 10;
//	public static final int SETMESSAGE_CHANGE 			= 12;
//	public static final int SETMESSAGE_GROUP_CHANGE 	= 13;
//	public static final int SETTING_NEW_CONFERENCE_NAME = 14;
//	private TpGroup tpGroup = null;
//	private int skyId 		= -2;
//	private Handler handler;
//	private ChatListDb dbChat;
//	private FriendDb friendDb;
//	private NotificationDb dbNoti;
	private Toast toast;
//	
//	public boolean isMessage = false;
//	public boolean isNotificaiton = false;
//	public boolean isDiscover = false;
//	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ApplicationTrans appState = (ApplicationTrans) getApplicationContext();
		appState.addActivityToContainer(this);
		
	}
	public void SetOnBackClickListener(ImageButton btn)
	{
		if(btn!=null){
			btn.setOnClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					BaseActivity.this.finish();
					
				}
			});
		}
	}
	
//	
//	public void setValues(TpGroup tpGroup, int skyId, Handler handler){
//		this.tpGroup	= tpGroup;
//		this.skyId		= skyId;
//		this.handler	= handler;
//	}
//	
//	public void setIsMessage(boolean bool, Handler handler){
//		isMessage		= bool;
//		this.handler	= handler;
//	}
//
//	public void setHandler(Handler handler){
//		this.handler	= handler;
//	}
//	
//	public void setIsNotification(boolean bool){
//		isMessage	= bool;
//	}
//	
//	public void setIsDiscover(boolean bool){
//		isDiscover	= bool;
//	}
	
	@Override
	protected void onDestroy() {
		ApplicationTrans appState = (ApplicationTrans) getApplicationContext();
		appState.removeActivityToContainer(this);
		super.onDestroy();

	}


	@Override
	protected void onStart() {
		super.onStart();
		
	}

	@Override
	protected void onStop() {
		super.onStop();
//		unregisterReceiver(receiver);
	}
	
	public void showToast(String msg){
    	if(toast == null){
    		toast = Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT);
//    		toast.setGravity(Gravity.CENTER, 0, 0);
    	}else{
    		toast.setText(msg);
    	}
    	toast.show();
    }
}



